// pages/superCustom/index.js
import Http from '../../utils/http.js';
let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    commodityList:[],
    loading:false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData()
  },
  getData(){
    wx.showLoading({
      title: '加载中',
      mask: true
    })
    this.setData({
      loading: true
    })
    Http.Request('get', '/api/customer/commodity/getCommodityByGroupName/超值定制/v1').then(res => {
      this.setData({
        commodityList: res,
        loading:false
      })
      wx.hideLoading();
    }).catch(err => {
      wx.hideLoading();
      app.globalFn.reLoad(this.getData, err)
    })
  },
  itemClick(e) {
    const commodityCode = e.currentTarget.dataset.item.commodityCode;
    wx.navigateTo({
      url: `../travelList/travelDetail/travelDetail?commodityCode=${commodityCode}`
    })
  },
  onShareAppMessage() {
    app.globalFn.onShareAppMessage()
  }
})